package com.example.demo.component;

import com.example.demo.constants.Constants;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Component
public class TopicListener {
    @RabbitListener(queues = Constants.TOPIC_QUEUE1)
    public void listenerQueue1(Message message) {
        System.out.println("listener 1[" + Constants.TOPIC_QUEUE1 + "]收到消息: " + message);
    }

    @RabbitListener(queues = Constants.TOPIC_QUEUE2)
    public void listenerQueue2(Message message) {
        System.out.println("listener 2[" + Constants.TOPIC_QUEUE2 + "]收到消息: " + message);
    }
}
